package com.mapaoer.user.entity;

import lombok.Data;
import com.baomidou.mybatisplus.annotation.*;
import java.time.LocalDateTime;

import java.util.Set;

@Data
@TableName("sys_role")
public class Role {
    @TableId(type = IdType.AUTO)
    private Long id;

    @TableField(nullable = false, unique = true)
    private String name;

    @TableField(nullable = false)
    private String description;

    public void setDescription(String description) {
        this.description = description;
    }

    // 权限集合（通过MyBatis-Plus关联查询实现）
    private Set<Permission> permissions;

    public void setPermissions(Set<Permission> permissions) {
        this.permissions = permissions;
    }

    @TableField(fill = FieldFill.INSERT)
    private LocalDateTime createTime;

    @TableField(fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;
}